const request = new Promise((resolve, reject) => {
    setTimeout(() => resolve('收到服务器数据'))
})
function abortWrapper(p1) {
    let abort
    const p2 = new Promise((resolve, reject) => {
        abort = reject
    })
    // 如果没有resolve或reject，p2的状态永远是pending
    const p = Promise.race([p1, p2])
    p.abort = abort
    return p
}
const req = abortWrapper(request)
let promise2 = new Promise((resolve, reject) => {
    setTimeout(() => {
        reject('网络超时')
    }, 2000)
})